/*!
 * tykhome - notify.js
 * Author tykhome <yongketian@gmail.com>
 */

/**
 * Module dependencies.
 */
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var ObjectId = Schema.ObjectId;

var NotifySchema = new Schema({
	type: { type: String },
	from: { type: ObjectId },
	to: { type: ObjectId },
	message: { type: String }, 
	has_read: { type: Boolean, default: false },
	create_at: { type: Date, default: Date.now }
});

NotifySchema.index({to: 1, create_at: -1});

mongoose.model('Notify', NotifySchema);
